﻿using System;
using System.Diagnostics.Contracts;
using System.IO;

namespace O1.IO.Storage
{
    [ContractVerification(true)]
    public abstract class TrunkFile : IDisposable
    {
        public abstract long FileSize { get; }

        public abstract Stream Stream { get; }

        public void Dispose()
        {
            this.Dispose(true);
            GC.SuppressFinalize(this);            
        }

        protected virtual void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (this.Stream != null)
                {
                    this.Stream.Close();
                }
            }
        }
    }
}
